package com.gitee.swsk33.catconsumer.api;

import com.gitee.swsk33.catprovider.dataobject.Cat;
import com.gitee.swsk33.catprovider.model.Result;
import com.gitee.swsk33.catprovider.service.CatService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/cat")
public class CatAPI {

	@DubboReference
	private CatService catService;

	@PostMapping("/add")
	public Result add(@RequestBody Cat cat) {
		return catService.add(cat);
	}

	@GetMapping("/get/{id}")
	public Result<Cat> get(@PathVariable("id") int id) {
		return catService.get(id);
	}

}